@extends('admin.layout.main')

@section('content')
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
	<li>
		<i class="ace-icon fa fa-home home-icon"></i>
		<a href="#">系统管理</a>
	</li>
	<li class="active"><a href="{{ url('admin/sms') }}">验证码列表</a></li>
</ul><!-- /.breadcrumb -->

<div class="nav-search" id="nav-search">
	<form class="form-search">
		<span class="input-icon">
		<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
			<i class="ace-icon fa fa-search nav-search-icon"></i>
		</span>
	</form>
</div><!-- /.nav-search -->
</div>
<div class="page-content">
	<div class="row">
		<div class="col-xs-12">
			<div class="row center">
				<h3>
					<a href="/admin/sms?type=2"><button class="btn btn-white btn-info btn-bold @if($type==2) active @endif">邮箱验证码</button></a>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<a href="/admin/sms?type=1"><button class="btn btn-white btn-info btn-bold @if($type==1) active @endif">手机验证码</button></a>
				</h3>
			</div>
			<!-- PAGE CONTENT BEGINS -->
			<div class="row">
				<div class="col-xs-12">
					<div class="clearfix">
						<div class="pull-right tableTools-container"></div>
					</div>
					<div class="table-header">
						<span class="menu-text orange"> 验证码记录 </span>
					</div>

					<!-- div.table-responsive -->

					<!-- div.dataTables_borderWrap -->
					<div>
						<table id="dynamic-table" class="table table-striped table-bordered table-hover">
							<thead>
								<tr>
									<th>序号</th>
									<th>会员ID</th>
									<th class="hidden-480">
										@if($type==1)
											手机号码
										@else
											会员邮箱
										@endif
									</th>
									<th>
										验证码
									</th>
									<th class="hidden-480">验证内容</th>

									<th>状态</th>
									<th>发送时间</th>
								</tr>
							</thead>

							<tbody>
								@foreach($data as $key => $val)
								<tr>
									<td>
										<a href="#">{{$key+$page_num}}</a>
									</td>
									<td>
										@if($val->user)
											{{$val->user->account}}
										@else
											游客
										@endif
									</td>
									<td class="hidden-480">
										@if($type==1)
											{{$val->phone}}
										@else
											{{$val->email}}
										@endif
									</td>
									<td>{{$val->code}}</td>
									<td class="hidden-480">
										@if($type==1)
											{{\App\Models\PhoneSms::$TYPE[$val->type]}}
										@else
											{{\App\Models\EmailSms::$TYPE[$val->type]}}
										@endif
									</td>
									<td>
										发送成功
									</td>
									<td>
										{{ date("Y-m-d H:i:s",$val->send_time)}}
									</td>
								</tr>
								@endforeach
							</tbody>
						</table>
					</div>
				</div>
			</div>
			<!-- PAGE CONTENT ENDS -->
		</div><!-- /.col -->

		<div class="modal-footer no-margin-top">
			<ul class="pagination pull-right no-margin">
				{{$data->appends(['type' => $type])->links()}}
			</ul>
		</div>
	</div><!-- /.row -->
</div><!-- /.page-content -->

@endsection
